﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NotificationDetails.aspx.cs" Inherits="Agents.NotificationDetails" %>
<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit"%>
<%@ Import Namespace="Agents.Data" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <title>מערכת סוכנים</title>
    <link href="../Styles/SiteMaster.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/Popup.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/Common.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="mainForm" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div id="page">
        <div id="mainBody">
            
            <div class="operationDiv">
                <asp:DetailsView ID="DetailsView" runat="server" DataSourceID="SqlDataSource1" 
                    HeaderStyle-Font-Bold="true" CaptionAlign="Right" Width="100%"
                    AllowPaging="False" BorderStyle="None" AutoGenerateRows="false" GridLines="None">
                    <Fields>
                        <asp:TemplateField ItemStyle-CssClass="header" ShowHeader="false">
                            <ItemTemplate> 
                                התראה על
                                <asp:Label ID="lblTitle" runat="server" 
                                Text='<%# ((NotificationTypes)Enum.Parse(typeof(NotificationTypes), 
                                        Eval("NotificationType").ToString())).GetStringRepresentation() %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate> 
                                <br />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="תאריך התראה:">
                            <ItemTemplate>
                                <asp:Label ID="lblDate" runat="server" Text='<%# Bind("Date") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="מוצר:">
                            <ItemTemplate>
                                <asp:Label ID="lblProductName" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="פרטי ההתראה:">
                            <ItemTemplate>
                                <table runat="server" Visible='<%# ((NotificationTypes)Enum.Parse(typeof(NotificationTypes), 
                                        Eval("NotificationType").ToString())) == NotificationTypes.LACK_NOTIFICATION %>'>
                                    <tr>
                                        <td>פריטים במלאי:</td>
                                        <td>
                                            <asp:Label ID="lblItemsInStock" runat="server" Text='<%# Bind("ItemsInStock") %>'>
                                            </asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>סף מינימום לפריטים במלאי:</td>
                                        <td>
                                            <asp:Label ID="lblThreshold" runat="server" Text='<%# Bind("Threshold") %>'>
                                            </asp:Label>
                                        </td>
                                    </tr>
                                </table>

                                 <table runat="server" Visible='<%# ((NotificationTypes)Enum.Parse(typeof(NotificationTypes), 
                                        Eval("NotificationType").ToString())) == NotificationTypes.DEAD_STOCK_NOTIFICATION %>'>
                                    <tr>
                                        <td>תאריך הזמנה אחרונה:</td>
                                        <td>
                                            <asp:Label ID="lblLastOrderDate" runat="server" Text='<%# Bind("LastOrderDate") %>'>
                                            </asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>מס' ימים מקסימלי מההזמנה האחרונה:</td>
                                        <td>
                                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("MaxDaysFromLastOrder") %>'>
                                            </asp:Label>
                                        </td>
                                    </tr>
                                </table>
                                
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Fields>
                </asp:DetailsView>  
                
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:AgentConnectionString %>" 
                    SelectCommand="SELECT   Name, Date, ItemsInStock, Threshold, LastOrderDate, 
                                            MaxDaysFromLastOrder, NotificationType FROM Notifications JOIN Products
                                    ON (Notifications.ProductId = Products.Id) WHERE (Notifications.Id = @notificationId)">
                        <SelectParameters>
                            <asp:QueryStringParameter QueryStringField="notificationId" Name="notificationId" />
                        </SelectParameters>
                </asp:SqlDataSource>
            </div>

            <div class="alignCenter">    
                <br />           
                <hr />           
                <asp:Button ID="closeBtn" Text="סגור" runat="server" onclick="closeBtn_Click" CssClass="button"/>
                <asp:Button ID="deleteBtn" Text="מחק" runat="server" onclick="deleteBtn_Click" CssClass="button"/>
                <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server"
                    TargetControlID="deleteBtn" DisplayModalPopupID="modalPopUp" />
                <asp:Panel ID="popup" runat="server" CssClass="popup">
                    <table>
                        <tr><td colspan="2">האם אתה בטוח שברצונך למחוק את ההתראה?</td></tr>
                        <tr>
                            <td><asp:Button ID="ok" Text="כן" runat="server" CssClass="button" /></td>
                            <td><asp:Button ID="cancel" Text="לא" runat="server" CssClass="button" /></td>
                        </tr>
                    </table>
                </asp:Panel>
                <ajaxToolkit:ModalPopupExtender ID="modalPopUp" CancelControlID="cancel" PopupControlID="popup"
                    OkControlID="ok" runat="server" TargetControlID="deleteBtn" />
            </div>
             
        </div>        
        
    </div>
    </form>
</body>
</html>




